var http=require("http");
var url=require("url");
var fs=require("fs");

http.createServer(function(request,response){
    var urlInfo=url.parse(request.url);
    console.log("完整的url:http://"+request.headers.host+request.url);
    if(request.url.indexOf(".html")!=-1){
            response.writeHead(200,{'Content-Type':"text/html"});
            //response.end('处理html页面逻辑');
            var stream=fs.readFileSync("index.html");
            response.end(stream);
            return;
    }
    response.writeHead(200,{'Content-Type':"text/plain"});
    response.end('Hello World');
}).listen(8888);
console.log('Server running at http://127.0.0.1:8888/');
